#define SERVER_PORT 6001
#define SERVER_IP "192.168.224.101"
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>


int main(int argc, char **argv)
{
    int server_fd;
    server_fd = socket(AF_INET, SOCK_DGRAM, 0); //UDP
    if (server_fd < 0)
    {
        perror("socket");
        return 1;
    }
    struct sockaddr_in ser_addr;
    ser_addr.sin_family = AF_INET;
    ser_addr.sin_addr.s_addr = inet_addr(SERVER_IP);
    ser_addr.sin_port = htons(SERVER_PORT);

    if(bind(server_fd, (struct sockaddr*)&ser_addr, sizeof(ser_addr)) < 0){//绑定端口号与IP
		perror("bind");
		return 2;
	}
    char buffer_back[1024];
    recvfrom(server_fd, buffer_back, sizeof(buffer_back), 0, NULL, NULL);
    printf("server ack# \r\n");
    close(server_fd);
}
